<template>
	<view class="listBox">
		<messageList :list="list" :type="AppointmentType" @changeList="changeList"></messageList>
	</view>
</template>

<script>
import messageList from '@/components/messageList/messageList.vue';
export default {
	components: {
		messageList
	},
	data() {
		return {
			title: '',
			AppointmentType: '一起挥',
			list: [],
			PageIndex: 1,
			PageSize: 10,
			isAll: false
		};
	},
	onLoad(e) {
		this.title = e?.title
		this.AppointmentType = e?.AppointmentType || '一起挥'
		uni.setNavigationBarTitle({
			title: e.title,
			success: function () {
			},
			fail: function (err) {
			}
		});
		this.getContactList()
	},
	// 触底事件
	onReachBottom() {
		if (!this.isAll) {
			this.PageIndex++;
			this.getContactList()
		}
	},
	methods: {

		async getContactList() {
			let res = await this.$api.post("Appointment/QuickDealUser", {
				PageIndex: this.PageIndex,
				PageSize: this.PageSize,
				AppointmentType: this.AppointmentType,
			})
			if (res.code == 0) {
				this.list = this.PageIndex == 1 ? this.list = res.data : this.list.concat(res.data)
				this.isAll = (res.data.length < this.PageSize) ? true : false
			}
		},
		changeList(status, index) {
            let listData = this.list[index]
            listData.Status = status
            this.$set(this.list, index, listData)
        },
	}
}
</script>
</script>

<style lang="scss">
page {
	background-color: #f6f6f6;
}
.listBox{
	width: 100%;
	padding-bottom: 60rpx;
}
</style>
